<link href="Style.css" rel="stylesheet" type="text/css" />
<?php
session_start(); 

require("sql_functions.php");

if(isset($_SESSION['user']))
{
	$user = $_SESSION['user'];
	
	if( isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == 1)
	{			
		$emps = sql_getEmployees();
    
	
		$email = $emp['Email'];
			
		echo "<html>"; 
		echo "<head>"; 
		echo "</head>"; 
		echo "<body>";
		echo "<p>Employee Management"; 
		echo "<p>Employee List";
		
		echo "<table border='1'>";	
		echo "<tr><td>Name</td><td>Email</td><td>Certifications</td>";
		while($row = mysql_fetch_array($emps))
		{		
			$name = $row['FirstName'] . ' ' . $row['LastName'];
			$email = $row['Email'];
			$certs = sql_getEmployeeCertifications($email);
			$numCerts = mysql_num_rows($certs);

			echo "<tr><td>";
			echo "<a href=\"view_employee.php?email=$email\">$name</a>";
			echo "</td><td>";
			echo "$email";
			echo "</td><td>";
			echo "$numCerts";
			echo "</td></tr>";
		}
		echo "</table>";
    	
		echo "<form action=\"employee_info.php\" method=\"POST\">"; 
		echo "<p><input type=\"submit\" name=\"save\" value=\"New Employee\" />"; 
		echo "</form>"; 
  
		echo "<p><a href=\"index.php\">Log Out</a>";

		echo "</body>"; 
		echo "</html>"; 
 
	}
	
	else
	{
		echo "You do not have the rights to view this page";
	}
}
else
{
	echo "Must be logged in to view this page.";
}

?>




